package main

import (
	"hero/biz"
	"micros/server"
	"micros/toolkit"
)

func initTable() {
	db := toolkit.GetXBoxDB()
	db.DropTable(&biz.Hero{})
	db.CreateTable(&biz.Hero{})
}

func main() {
	r := server.NewServer("hero")
	initTable()
	r.Route.POST("/hero", biz.CreateHandler())
	r.Route.GET("/hero/:id", biz.GetHandler())
	r.Route.PUT("/hero", biz.UpdateHandler())
	r.Route.DELETE("/hero", biz.DeleteHandler())
	r.Route.Run()
}
